import {resolve, dirname} from 'path';
import {fileURLToPath} from 'url';
import alias from '@rollup/plugin-alias';
import typescript from '@rollup/plugin-typescript';
import terser from '@rollup/plugin-terser';
import rollupResolve from '@rollup/plugin-node-resolve';
const __dirname = dirname(fileURLToPath(import.meta.url));
export default {
    input: 'src/index.ts',
    output: {
        dir: 'dist',
        format: 'esm',
        sourcemap: true
    },
    plugins: [
        rollupResolve({
            extensions: ['.ts', '.json']
        }),
        typescript(),
        terser(),
        alias({
            entries: [
                {find: '@', replacement: resolve(__dirname, './src')}
            ]
        })
    ],
    external: ['koa', 'joi', 'koa-router', 'koa-bodyparser', 'mongoose', 'redis']
};